#!/usr/bin/env python
import sys, os

HOME_DIR = os.getenv ('HOME')
CURR_DIR = os.getcwd ()
FILES    = os.listdir (HOME_DIR)

def install_module (src, dest, orig):
    if dest in FILES:
        cmd = ' '.join (['mv',
                         os.path.join (HOME_DIR, dest),
                         os.path.join (HOME_DIR, orig)])
        os.system (cmd)
    cmd = ' '.join (['ln -s', 
                     os.path.join (HOME_DIR,CURR_DIR,src),
                     os.path.join (HOME_DIR,dest)])
    os.system (cmd)

if __name__ == '__main__':

    # install bashrc
    install_module ('bashrc', '.bashrc', 'bashrc_ORIG')

    # install vimrc
    install_module ('vimrc', '.vimrc', 'vimrc_ORIG')

    # install inputrc
    install_module ('inputrc', '.inputrc', 'inputrc_ORIG')

    # install vim
    install_module ('vim', '.vim', 'vim_ORIG')


